<template>
  <div >
   <div class="movie-item" @click="toDetail(movie)">
      <img class='movie-img' :src="movie.img | imgFilter" />
      <div class='movie-info'>
          <div class='movie-name line-ellipsis'>{{movie.nm}}</div>
          <div class='movie-score line-ellipsis'>
            <div v-if="movie.globalReleased">
              <span v-if="movie.sc">观众评分：<span class='grade'>{{movie.sc}}</span></span>
              <span v-else>暂无评分</span>
            </div>
            <div v-else><span class='grade'>{{movie.wish}}</span>人想看</div>
          </div>
          <div class='movie-star line-ellipsis'>{{movie.star}}</div>
          <!-- <div v-if="!movie.globalReleased">{{movie.rt}}上映</div> -->
          <div  class='movie-showInfo line-ellipsis'>{{movie.showInfo}}</div>
      </div>
      <div class='buy-tickets'>
      <div v-if="movie.showst===3"  class='btn'>购票</div>
      <div v-else-if='movie.showst===1' class='btn want-see'>想看</div>
      <div v-else='movie.showst===4' class='btn pre-sale'>预售</div>
    </div>
   </div>
  </div>
</template>

<script>
  export default {
    name:'MovieItem',
    props:['movie'],
    methods: {
      toDetail(movie){
        const movieId = movie.id
        // console.log(this.$route);
        // if(this.$route.meta.type==='hot'){
          // console.log('@');
          this.$router.push({
            name:'movieDetail',
            query:{movieId}
          })
        // }
        // console.log(movieId);
      }
    },
  }
</script>

<style lang="less" scoped>
  .movie-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 124px;
  padding: 0 15px;

  &::after{
  position: absolute;
  content: '';
  height: 0;
  width: calc(100% - 100px);
  right:15px;
  bottom:0;
  border-bottom: 1px solid #f0f0f0;
  }
  .movie-info{
  margin: 0 20px;
  font-size: 14px;
  color: #666;
  width: 60%;
  &>div{
    width: 100%;
    margin-bottom:5px;
  }
  ::v-deep .movie-star{
  width: 190px;
}
  }
  .movie-img {
  width: 70px;
  height: 98px;
}
  .movie-name {
  font-size: 20px;
  color: #333;
  padding-right: 5px;
}

.grade {
  font-weight: 700;
  color: #faaf00;
  font-size: 15px;
}
}
</style>